package com.itheima.list;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Demo3 {
    public static void main(String[] args) {
        Collection<String> list = new ArrayList<>();

        list.add("123");
        list.add("345");

        Iterator<String> it = list.iterator();

        while (it.hasNext()){
            if("123".equals(it.next())){
                list.remove("123");
            }
        }

        System.out.println(list);
    }
}
